{% if (registry.has('theme_options') == constant('true')) %} 
  {% set class = 3 %} 
  {% set all = 4 %}
  {% set id = random(5000)*random(50000) %}

  {% set theme_options = registry.get('theme_options') %}
  {% set config = registry.get('config') %}

  {% if (module['content']['limit'] == 6) %} {% set class = 2 %} {% set all = 6 %} {% endif %}
  {% if (module['content']['limit'] == 5) %} {% set class = 25 %} {% set all = 5 %} {% endif %}
  {% if (module['content']['limit'] == 3) %} {% set class = 4 %} {% set all = 3 %} {% endif %}
  {% if (module['content']['limit'] == 2) %} {% set class = 6 %} {% set all = 2 %} {% endif %}
  {% if (module['content']['limit'] == 1) %} {% set class = 12 %} {% set all = 1 %} {% endif %} 

  <div class="matrialarts-products-tabs">
       <div class="row">
            <div class="col-sm-3">
                 <div class="description">{{ module['content']['description'] }}</div>
                 <ul id="matrialtab{{ id }}" class="select-tab">
                  {% set i = 0 %} {% for product_tab in module['content']['products_tabs'] %} 
                    <li {% if i == 0 %}class="active"{% endif %}><a href="#matrialartstabs-{{ id }}-{{ i }}">{{ product_tab['name'] }}</a></li>
                  {% set i = i + 1 %} {% endfor %} 
                 </ul>
            </div>
            
            <div class="col-sm-9">
                 <div class="tab-content clearfix">
                      {% set s = 0 %} {% for product_tab in module['content']['products_tabs'] %} 
                      <div class="tab-pane {% if (s == 0) %} {{ 'active' }} {% endif %}" id="matrialartstabs-{{ id~'-'~s }}">
                           <div class="box clearfix box-with-products without-heading">
                             <div class="box-content products">
                               <div class="box-product">
                                <div id="myCarousel{{ id }}">
                                  <!-- Carousel items -->
                                  <div class="carousel-inner">
                                    {% set i = 0 %} {% set row_fluid = 0 %} {% set item = 0 %} {% for product in product_tab['products'] %} {% set row_fluid = row_fluid + 1 %} 
                                      {% if (i == 0) %} {% set item = item + 1 %} {{ '<div class="active item"><div class="product-grid"><div class="row">' }} {% endif %} 
                                      {% set r=row_fluid-(row_fluid/all)|round(0, 'floor')*all %} {% if (row_fluid>all and r == 1) %} {{ '</div><div class="row">' }} {% endif %} 
                                      <div class="col-sm-{{ class }} {% if (class != 12) %}col-xs-6{% endif %} {% if (class == 2) %} {{ 'col-md-25 col-lg-2 col-sm-3 ' }} {% endif %} {% if (class == 2 and r == 0) %} {{ 'hidden-md hidden-sm' }} {% endif %} {% if (class == 2 and r == 5) %} {{ 'hidden-sm' }} {% endif %} {% if (class == 25) %} {{ 'col-md-25 col-lg-25 col-sm-3 ' }} {% endif %} {% if (class == 25 and r == 0) %} {{ 'hidden-sm' }} {% endif %}">
                                        {% include 'fastor/template/new_elements/product.twig' %}
                                      </div>
                                    {% set i = i + 1 %} {% endfor %} 
                                    {% if (i > 0) %} {{ '</div></div></div>' }} {% endif %} 
                                  </div>
                              </div>
                               </div>
                             </div>
                           </div>
                      </div>
                      {% set s = s + 1 %} {% endfor %} 
                 </div>
            </div>
       </div>     
  </div>

  <script type="text/javascript">
  $('#matrialtab{{ id }} a').click(function (e) {
    e.preventDefault();
    $(this).tab('show');
  })
  </script>
{% endif %}